package cn.zdm.demo.test.controller;

import cn.zdm.demo.common.result.ResultObject;
import cn.zdm.demo.common.result.ResultResponse;
import cn.zdm.demo.test.model.po.AuthRolePO;
import cn.zdm.demo.test.service.AuthRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * copyright (C), 2021, 武大吉奥科技有限公司
 *
 * @Program demo
 * @Description 角色测试接口
 * @Author ZhaoDeman
 * @Create 2021/3/1 20:50
 * @Version 1.0.0
 * <author>                <time>                  <version>                   <description>
 * ZhaoDeman        2021/3/1 20:50                 1.0                        角色测试接口
 */
@RestController
@Api(tags = {"测试接口"})
@RequestMapping("/auth")
public class AuthRoleController {

    @Autowired
    private AuthRoleService authRoleService;

    @PostMapping("/add")
    @ApiOperation(value = "新增角色")
    public ResultObject<Object> addRole(@RequestBody AuthRolePO authRolePO){
        //1、对数据进行校验
        //2、添加
        return authRoleService.addRole(authRolePO) > 0 ? ResultResponse.success("新增成功") : ResultResponse.error();
    }
}
